<script>
    let arr = [{ label: '男',value: 1 }, { label: '女',value: 0 }]
        function f(arr) {
            // 写代码，得到
            let obj1 = {}
           arr.forEach(item => {
                // console.log(item)
             let arr1 =  Object.values(item)
            obj1[arr1[1]] = arr1[0]
            // console.log(obj1)  
            //   obj2 = Object.assign(obj1)
            });
              return obj1
        }
        let obj = f(arr);
        console.log(obj)  // {0: '女', 1: '男'}
// obj2 = {'1': '男'， '0': '女'}
</script>